<?php 
include('../common/_const.php');
include('../common/common.php');
include('../common/checksession.php');
checksession("../index.php");
include('../../inc/conn.php');

$typeid			=$_POST['typeid'];
$ishidden		=$_POST['ishidden'];
$parent_cat		=$_POST['parent_cat'];
$cat_rank		=$_POST['cat_rank'];
$cat_name		=isempty(exquot(excode($_POST['cat_name'])));
$seo_title		=isempty(exquot(excode($_POST['seo_title'])));
$cat_keywords	=isempty(exquot(excode($_POST['cat_keywords'])));
$cat_description=isempty(exquot(excode($_POST['cat_description'])));
$gurl	 		=$_POST["gurl"];


isnum($typeid,"栏目信息错误!",$gurl);
isnum($cat_rank,"请证确填写排序!",$gurl);

$db=db_connect();//数据库连接

$updateValue="`topid`='".$parent_cat."',";
$updateValue.="`sortrank`='".$cat_rank."',";
$updateValue.="`ishidden`='".$ishidden."',";
$updateValue.="`typename`='".$cat_name."',";
$updateValue.="`keywords`='".$cat_keywords."',";
$updateValue.="`seotitle`='".$seo_title."',";
$updateValue.="`description`='".$cat_description."'";

$sql=update_sql("`".PRETABLE."arctype`",$updateValue,"`id`='".$typeid."'");
if($db->query($sql)){
	ShowMsg_h("修改成功!","../moduls/catalog_main.php");
}else{
	ShowMsg("<font color=\"#FF0000\">未知错误,添加失败!请重新添加!</font>",$gurl);
}
$db->close();
?>